﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using Utilities.IO;

namespace Utilities.Net
{
    public class PacketReceivedEventArgs : EventArgs
    {
        public PacketReceivedEventArgs()
        {

        }
    }
    public class TcpServerClient : TcpConnection
    {
        public TcpServerClient(TcpClient client) : this(client, BitOrder.LittleEndian, typeof(sbyte))
        {
        }
        public TcpServerClient(TcpClient client, BitOrder bitOrder, Type stringPrefixType) : base(client, bitOrder, stringPrefixType)
        {
        }

        public void OnPacketReceived()
        {
            if (PacketReceived != null)
                PacketReceived(this);
            ReadAsync(OnPacketReceived);
        }
        public Action<Connection> PacketReceived;

        // TODO: Créer une classe BufferStream pour garder un historique (utilisation de QueueStream ?)
        //public event EventHandler<PacketReceivedEventArgs> PacketReceived;
    }
}
